Fine-Grained Function Visibility for Multiple Dispatch with Multiple Inheritance
نویسندگان
چکیده
Object-oriented languages with multiple dispatch and multiple inheritance provide rich expressiveness but statically and modularly checking programs in such languages to guarantee that no ambiguous calls can occur at run time has been a difficult problem. We present a core calculus for Fortress, which provides various language features—notably functional methods and components— and solves the problem. Functional methods are declared within traits and may be inherited but are invoked by ordinary function calls, and therefore compete in overloading resolution with ordinary function declarations. A novel component system governs “visibility” of types and functions, and allows fine-grained control over the import of overloaded functions. We formally define the type system of Fortress with a set of static rules to guarantee no ambiguous calls at run time, and mechanize the calculus and its type safety proof in COQ.
منابع مشابه
Coq Mechanization of Featherweight Fortress with Multiple Dispatch and Multiple Inheritance
In object-oriented languages, overloaded methods with multiple dispatch extend the functionality of existing classes, and multiple inheritance allows a class to reuse code in multiple classes. However, both multiple dispatch and multiple inheritance introduce the possibility of ambiguous method calls that cannot be resolved at run time. To guarantee no ambiguous calls at run time, the overloade...
متن کاملFast and Compact Dispatching for Dynamic Object-Oriented Languages
Dynamic Object-Oriented languages allows for dynamic deenition of new classes, new generic functions and new methods. This paper proposes a single and compact data structure to, at the same time, facilitate the addition of new classes, generic functions or methods, and still ensure a fast method selection. Within a dynamic Object-Oriented language, new classes, new generic functions and new met...
متن کاملIncremental Table-based Method Dispatch for Reeexive Object-oriented Languages
A collection of algorithms and data structures are presented which provide incremental dispatch table modiication. Incrementally modiied dispatch tables allow table-based dispatch techniques to be used in reeexive, dynamically typed, single-receiver languages with type/implementation-paired multiple inheritance. By storing a small amount of information, the algorithms can incrementally maintain...
متن کاملModularly Typesafe Interface Dispatch in JPred
Multiple dispatch generalizes the receiver-oriented dynamic dispatch of traditional object-oriented (OO) languages by allowing the run-time classes of all arguments to be employed. While research over the last decade has shown how to integrate multiple dispatch with the modular static typechecking found in traditional OO languages, that work has been forced to impose unnatural restrictions or m...
متن کاملReport on language support for Multi-Methods and Open-Methods for C++
Multiple dispatch – the selection of a function to be invoked based on the dynamic type of two or more arguments – is a solution to several classical problems in object-oriented programming. We present the rationale, design, and implementation of a language feature, called open multi-methods, for C++. Open multi-methods support both repeated and virtual inheritance and our call resolution rules...
متن کامل